package team.bluepen.supermarket.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import space.lingu.light.Light;
import space.lingu.light.connect.simple.DisposableConnectionPool;
import space.lingu.light.log.LightSlf4jLogger;
import space.lingu.light.sql.MySQLDialectProvider;
import team.bluepen.supermarket.data.database.SupermarketSystemDatabase;

/**
 * @author RollW
 */
@Configuration
public class DatabaseConfiguration {


    @Bean
    public SupermarketSystemDatabase supermarketSystemDatabase() {
        return Light.databaseBuilder(SupermarketSystemDatabase.class, MySQLDialectProvider.class)
                .setLogger(LightSlf4jLogger.createLogger(SupermarketSystemDatabase.class))
                .setConnectionPool(DisposableConnectionPool.class)
                .build();
    }
}
